/**
 * Classname :Constants.java
 *
 * Version information: 1.0
 *
 * Date: Jan 04, 2010 ho.viet.duan create
 *
 * Planex Viet Name co.ltd, All Rights Reserved.
 */

package com.zho.common.utility;

import com.zho.util.Helpers;

import com.opensymphony.xwork2.ActionSupport;

public interface Constants {

	public interface DATE {
		final String DATE_FORMAT = "dd/MM/yyyy";
		final String DATE_FORMAT_DATETIMEPICKER = "MM/dd/yyyy";
		final String DATE_FORMAT_DATETIMEPICKER_ADDTIME = "MM/dd/yyyy HH:mm:ss";
		final String DATE_FORMAT_DATEDB = "yyyy/MM/dd";
		final String DATE_FORMAT_DATE_DISPLAY = "dd/MM/yyyy HH:mm:ss";
		final String DATE_FORMAT_IN_SECOND = "yyyy-MM-dd HH:mm:ss";
		final String DATE_FORMAT_ALL_DATE = "dd/MM/yyyy HH:mm:ss";
		final String DATE_FORMAT_ALL_DATE_SEC = "ddMMyyyyHHmmss";
		final String DATE_FORMAT_IN_MILI_SEC = "yyyy/mm/dd hh:mm:ss,SSS";
		final String DATE_FORMAT_yyyMMdd = "yyyyMMdd";
		final String DATE_FORMAT_DISPLAY = "dd/MM/yyyy";
		final String DATETIME_FORMAT_DISPLAY = "dd/MM/yyyy HH:mm";
		final String DATETIME_FORMAT_SEC_DISPLAY = "dd/MM/yyyy HH:mm:ss";
		final String DATE_FORMAT_DATETIMEPICKER_DISPLAY = "dd/mm/yy";
	}

	public interface SessionKeys {

	}

	public interface SeparatorKey {
		final String SUBTRACT = "-";
		final String COMMA = ",";
		final String UnderScore = "_";
	}

	public interface DeletedOption {
		Integer DELETED = new Integer(1);
		Integer UN_DELETED = new Integer(0);
		Integer UNKNOW = new Integer(-1);
		Integer[] ALL = new Integer[] { DELETED, UN_DELETED };
	}

	public interface WebStatistic {

	}

	public interface UniqueCode {
		String CUSTOMER = "CUS";
	}

	public interface ActionType {
		String CREATE = "CREATE";
		String JOIN = "JOIN";
		String VIEW = "VIEW";
	}

	public interface QueryName {
		// Account
		String CUSTOMER_DELETE_BY_ID_LIST = "Customer.DeleteByIdList";
		String CUSTOMER_UPDATE_GENERAL_ACCOUNT_SETTINGS = "Customer.UpdateGeneralAccountSettings";
		String CUSTOMER_UPDATE_PROFILE_PICTURE = "Customer.UpdateProfilePicture";
		String CUSTOMER_UPDATE_PASSSWORD = "Customer.UpdatePassword";
		String CUSTOMER_DEPOSIT = "CustomerBalance.DepositCustomer";
		String CUSTOMER_STATISITC_INCREASE = "customerStatistic.Increase";
		String CG_BAL_FIND_BY_CURRENCY = "cgBalance.FindByCurrency";
	}

	public interface Active {
		Integer NONE = -1;
		Integer ACTIVE = 1;
		Integer INACTIVE = 0;
	}

	public class ActiveEnum {
		public static ActiveEnum NONE = new ActiveEnum(null,
				"constant.active.none");
		public static ActiveEnum ACTIVE = new ActiveEnum(Active.ACTIVE,
				"constant.active.active");
		public static ActiveEnum INACTIVE = new ActiveEnum(Active.INACTIVE,
				"constant.active.inactive");

		public static ActiveEnum[] values() {
			return new ActiveEnum[] { NONE, ACTIVE, INACTIVE };
		}

		private Integer value;
		private String text;
		private String textKey;

		public Integer getValue() {
			return value;
		}

		public String getText() {
			return text;
		}

		private ActiveEnum(Integer value, String textKey) {
			this.value = value;
			this.textKey = textKey;
		}

		private void setText(String text) {
			this.text = text;
		}

		public String getTextKey() {
			return textKey;
		}

		public Integer intValue() {
			if (this.equals(ACTIVE)) {
				return Active.ACTIVE;
			} else if (this.equals(INACTIVE)) {
				return Active.INACTIVE;
			}
			return null;
		}

		public Integer booleanValue() {
			if (this.equals(ACTIVE)) {
				return Active.ACTIVE;
			} else if (this.equals(INACTIVE)) {
				return Active.INACTIVE;
			}
			return null;
		}

		public boolean isActive() {
			return this.equals(ACTIVE);
		}

		public static boolean isActive(Integer value) {
			if (value == null) {
				return false;
			}
			return value.intValue() == Active.ACTIVE;
		}

		public static ActiveEnum valueOf(Integer value) {
			if (value == null) {
				return null;
			}
			ActiveEnum[] values = ActiveEnum.values();
			if (values == null) {
				return NONE;
			}
			for (ActiveEnum v : values) {
				if (v.getValue() != null && v.getValue().equals(value)) {
					return v;
				}
			}
			return null;
		}

		public static ActiveEnum[] values(ActionSupport actionSupport) {
			ActiveEnum[] values = ActiveEnum.values();
			if (values == null) {
				return null;
			}
			for (ActiveEnum v : values) {
				String text = actionSupport.getText(v.getTextKey());
				if (!Helpers.isEmpty(text)) {
					v.setText(text);
				}
			}
			return values;
		}

	}

	public interface BetPrivacy {
		Integer I_PUBLIC = 1;
		Integer I_PRIVATE = 0;
	}

}
